﻿#include "engine.h"
#include "lr_trend.h"
#include "data_types.hpp"

using namespace lt;

void lr_trend::on_init(lt::subscriber& suber)
{
	suber.regist_bar_receiver(_code, _period,this);
};

void lr_trend::on_destory(lt::unsubscriber& unsuber)
{
	unsuber.unregist_bar_receiver(_code, _period);
};

void lr_trend::on_bar(const bar_info& bar)
{
	//TODO 这里写趋势判断逻辑并且去触发
	if (_current_trend != trend_action_type::TACT_INVALID)
	{
		_current_trend = trend_action_type::TACT_INVALID;
		trigger(_code, _current_trend);
	}
}
